package edu.bbu.cshu.wmpc.formalization;

import edu.bbu.cshu.wmpc.core.LevelTypes;
import edu.bbu.cshu.wmpc.core.SourceCodeWmpc;
/**
 * <ul>
 * <li><b><i>Context</i></b></li>
 * <li style="list-style: none;"></li>
 * <li style="list-style: none;">
 * Enumeration that is used in executing the formalization called from the preset strategy.  
 * 
 * @author WMPC team
 * </li>
 * </ul>
 */ 
public enum Context {
	/**
	 * <ul>
	 * <li><b><i>INSTANCE</i></b></li>
	 * <li style="list-style: none;"></li>
	 * <li style="list-style: none;">
	 * Ensures that only a single instance of the enumeration exists.
	 * 
	 * </li>
	 * </ul>
	 */
	INSTANCE;
	
	/**
	 * <ul>
	 * <li><b><i>strategy</i></b></li>
	 * <li style="list-style: none;"></li>
	 * <li style="list-style: none;">
	 * {@link Formalization}'s type that contains the source code and the methods for formalization.
	 * </li>
	 * </ul>
	 */
	private static Formalization strategy;
    
	/**
	 * <ul style="margin-top: 24px;">
	 * <li><b><i>setStrategy</i></b></li>
	 * <li style="list-style: none;"></li>
	 * <li style="list-style: none;">
	 * <p style="margin-left: 7px;">{@code public void setStrategy({@link Formalization} strat)}</p>
	 * <br>	
	 * Sets the {@code strategy}.
	 * 
	 * @param strat - this will be the {@code strategy}  
	 * </li>
	 * </ul>
	 */
    public void setStrategy(Formalization strat) {
    	strategy = strat;
    }
    
    /**
     * <ul style="margin-top: 24px;">
	 * <li><b><i>executeFormalization</i></b></li>
	 * <li style="list-style: none;"></li>
	 * <li style="list-style: none;">
	 * <p style="margin-left: 7px;">{@code {@link SourceCodeWmpc} executeFormalization({@link LevelTypes} level)}</p>
	 * <br>	
	 * Calls function {@code executeFormalization} of the {@code strategy} passing the {@code level}.
	 * 
     * @param level - for this level will be executed the formalization
     * @return  the formalized {@code source code} 
     * </li>
	 * </ul>
     */
    public SourceCodeWmpc executeFormalization(LevelTypes level) {
        return strategy.executeFormalization(level);
    }
}
